<template>
  <div>
      <job-modul :bList=breadList></job-modul>
  </div>
</template>

<script>
import jobModul from '@/components/jobs/job_modul'
import {firstDeptTdeptList} from '@/api/getData'
export default {
  validate ({ params ,query}) {
    return params.id?true:false
  },
  data () {
      return{
        currentPageId: null,
        listData: [],
        breadList: [
          {
            text: '诚聘英才',
            routeName: ''
          },
          {
            text: '',
            routeName: ''
          }
        ] 
      }
  },
  created(){
    this.initalPage()
  },
  methods:{
    initalPage(){
      firstDeptTdeptList.call(this).then(res=>{
        this.$emit('onData',res)
        this.listData = res
        this.handelBread(res,this.$route.params.id)
      })
    },
    handelBread(list,cid){
      let result = list.filter(item=>{
        return cid == item.id
      })[0]
      this.breadList = [
        {
          text: '诚聘英才',
          routeName: `/jobs/list/${list[0].id}`
        },
        {
          text: result.deptname,
          routeName: ''
        }
      ]
      
    }
  },
  components: {
    jobModul
  },
  watch:{
    $route(to,form){
      this.initalPage()
    }
  }
}
</script>

<style lang="stylus" scoped>

</style>
